<template>
  <div class="app-container">
    <el-row :gutter="20">
      <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
        <!--指标数据-->
        <pane size="16">
          <el-col>
            <div class="head-container">
              <el-input v-model="indicatorName" placeholder="请输入指标名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
            </div>
            <div class="head-container">
              <el-tree
                ref="tree"
                :data="indicatorOptions"
                :props="defaultProps"
                :default-expanded-keys="defaultExpandedKeys"
                :expand-on-click-node="false"
                :default-expand-all="false"
                :auto-expand-parent="false"
                node-key="id"
                highlight-current
                @node-click="handleNodeClick">
              </el-tree>
            </div>
          </el-col>
        </pane>
        <!--附件列表-->
        <pane size="84">
          <el-col>
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
              <el-form-item label="附件名称" prop="fileName">
                <el-input
                  v-model="queryParams.fileName"
                  placeholder="请输入文件名"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
              </el-form-item>
            </el-form>
            <el-row :gutter="10" class="mb8">
              <el-col :span="1.5">
                <el-button
                  type="primary"
                  plain
                  icon="el-icon-upload"
                  size="mini"
                  @click="handleUpload"
                  v-hasPermi="['pg:attachment:add']"
                >上传附件</el-button>
              </el-col>
              <el-col :span="1.5">
                <!-- 多选删除按钮 -->
                <el-button
                  type="danger"
                  plain
                  icon="el-icon-delete"
                  size="mini"
                  :disabled="multiple"
                  @click="handleMultiDelete"
                  v-hasPermi="['pg:attachment:remove']"
                >批量删除</el-button>
              </el-col>
              <!-- 新增：显示当前选中的指标名称 -->
              <el-col :span="12" style="text-align: center;">
                <span v-if="currentIndicatorName" style="font-weight: bold; color: #C03639;">
                  当前指标：{{ currentIndicatorName }}
                </span>
              </el-col>
              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>
            <el-table ref="table" v-loading="loading" :data="attachmentList" @selection-change="handleSelectionChange" row-key="attachId">
              <el-table-column type="selection" width="55" align="center" />
<!--              <el-table-column label="附件编号" align="center" prop="attachId" width="80" />-->
              <el-table-column label="序号" align="center" width="80">
                <template slot-scope="scope">
                  <!-- 公式：(当前页-1)*每页条数 + 行索引 + 1 -->
                  {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
                </template>
              </el-table-column>
              <el-table-column label="文件名" align="left">
                <template slot-scope="scope">
                  <el-link class="ellipsis" type="primary" :title="scope.row.fileName" @click="handlePreview(scope.row)">{{ scope.row.fileName }}</el-link>
                </template>
              </el-table-column>
              <el-table-column label="文件类型" align="center" width="80">
                <template slot-scope="scope">
                  <!-- 从文件名中提取扩展名，无扩展名时显示“未知” -->
                  {{ scope.row.fileName
                  ? scope.row.fileName.split('.').pop().toUpperCase()
                  : '未知'
                  }}
                </template>
              </el-table-column>
              <el-table-column label="排序编号" align="center" prop="orderNum" width="80" />
              <el-table-column label="操作" align="center" class-name="small-padding" width="240">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-view"
                    @click="handlePreview(scope.row)"
                    v-hasPermi="['pg:attachment:query']"
                  >查看</el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-edit"
                    @click="handleUpdate(scope.row)"
                    v-hasPermi="['pg:attachment:edit']"
                  >修改</el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-delete"
                    @click="handleDelete(scope.row)"
                    v-hasPermi="['pg:attachment:remove']"
                  >删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <pagination
              v-show="total>0"
              :total="total"
              :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize"
              @pagination="getList"
            />
          </el-col>
        </pane>
      </splitpanes>
    </el-row>

    <!-- 添加预览对话框 -->
    <el-dialog
      :visible.sync="preview.visible"
      :title="preview.title"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :show-close="false"
      custom-class="force-close-dialog"
      :before-close="handleBeforeClose"
      width="80%"
      top="5vh"
      append-to-body
      >

      <!-- 自定义标题栏 -->
      <template #title>
        <span>{{ preview.title }}</span>
        <span style="float: right">
          <el-button size="mini" type="primary" icon="el-icon-full-screen" @click="handleOpenInNewWindow">浏览器中查看</el-button>
          <el-button size="mini" type="danger" icon="el-icon-close" @click="preview.visible = false">关闭窗口</el-button>
        </span>
      </template>

      <!-- PDF预览 -->
      <div v-if="preview.type === 'pdf'" style="height: 80vh;">
        <iframe
          :src="preview.url"
          style="width: 100%; height: 100%; border: none;"
          frameborder="0"></iframe>
      </div>

      <!-- 图片预览 -->
      <div v-else-if="preview.type === 'image'" style="text-align: center;">
        <el-image
          :src="preview.url"
          :preview-src-list="[preview.url]"
          fit="contain"
          style="max-height: 80vh; transform-origin: center center; transition: transform 0.3s ease;"
          :style="{ transform: `scale(${imageScale})` }"
          @wheel="handleImageZoom"
        >
        </el-image>
      </div>

      <!-- 其他文件类型 -->
      <div v-else>
        <p>不支持预览此文件类型</p>
        <el-link
          type="primary"
          :href="preview.url"
          target="_blank">
          下载文件
        </el-link>
      </div>
    </el-dialog>

    <!-- 上传附件对话框 -->
    <el-dialog title="上传附件"
               :close-on-click-modal="false"
               :close-on-press-escape="false"
               :show-close="false"
               custom-class="force-close-dialog"
               :before-close="handleBeforeClose"
               :visible.sync="upload.open" width="600px" append-to-body>
      <el-upload
        ref="upload"
        :action="upload.url"
        :headers="upload.headers"
        :file-list="upload.fileList"
        :auto-upload="false"
        :multiple="true"
        :limit="100"
        :on-exceed="handleExceed"
        :on-success="handleFileSuccess"
        :on-error="handleFileError"
        :on-change="handleFileChange"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击选择</em></div>
        <div class="el-upload__tip" slot="tip" style="color: red;font-weight: bolder;">
          可上传最多 100 个附件，单个文件不超过100MB，总大小不超过500MB。
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button @click="upload.open = false">取 消</el-button>
        <el-button type="primary" @click="submitUpload">开始上传</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改附件管理对话框 -->
    <el-dialog :title="title"
               :close-on-click-modal="false"
               :close-on-press-escape="false"
               :show-close="false"
               custom-class="force-close-dialog"
               :before-close="handleBeforeClose"
               :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="所属指标" prop="indicatorId">
          <el-input v-model="form.indicatorId" placeholder="请输入所属指标" readonly />
        </el-form-item>
        <el-form-item label="文件名" prop="fileName">
          <el-input v-model="form.fileName" placeholder="请输入文件名" readonly />
        </el-form-item>
        <el-form-item label="排序编号" prop="filePath">
          <el-input-number :min="0" :max="9999" :step="1" v-model="form.orderNum" type="" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listAttachment,
  getAttachment,
  delAttachment,
  addAttachment,
  updateAttachment,
  indicatorTreeSelect,
  previewFile
} from "@/api/pg/attachment"
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css"
import {uploadFile} from "../../../api/pg/attachment";
import {getToken} from "@/utils/auth";

export default {
  name: "Attachment",
  components: {Treeselect, Splitpanes, Pane},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 附件管理表格数据
      attachmentList: [],
      // 弹出层标题
      title: "",
      // 所有指标树选项
      indicatorOptions: [],
      // 过滤掉已禁用部门树选项
      enabledIndicatorOptions: undefined,
      // 是否显示弹出层
      open: false,
      // 指标名称
      indicatorName: undefined,
      imageScale: 1, // 图片缩放比例
      // ...其他数据
      defaultProps: {
        children: 'children',
        label: 'label',
        id: 'id'
      },
      upload: {
        open: false,
        url: process.env.VUE_APP_BASE_API + "/pg/attachment/upload",
        headers: {Authorization: "Bearer " + this.$store.getters.token},
        fileList: []
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        indicatorId: null,
        fileName: null,
        filePath: null,
        fileSize: null,
        fileType: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        indicatorId: [
          {required: true, message: "所属指标不能为空", trigger: "blur"}
        ],
        fileName: [
          {required: true, message: "文件名不能为空", trigger: "blur"}
        ],
        filePath: [
          {required: true, message: "存储路径不能为空", trigger: "blur"}
        ],
      },
      // 添加预览相关数据
      preview: {
        visible: false,
        title: '',
        url: '',
        type: ''
      },
      // 记录最后点击的节点
      lastClickedNode: null,
      defaultExpandedKeys: [], // 默认展开的节点keys
      currentIndicatorName: '赤峰学院' // 新增：当前选中的指标名称
    }
  },
  watch: {
    // 根据名称筛选部门树
    indicatorName(val) {
      this.$refs.tree.filter(val)
    }
  },
  created() {
    this.getList()
    this.getIndicatorTree()
  },
  methods: {
    /** 查询附件管理列表 */
    getList() {
      this.loading = true
      // 明确处理indicatorId参数
      const params = {
        ...this.queryParams,
        indicatorId: this.queryParams.indicatorId === null ? undefined : this.queryParams.indicatorId
      };
      listAttachment(params).then(response => {
        this.attachmentList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    safeLog(data) {
      console.log(JSON.parse(JSON.stringify(data)));
    },
    /**查询部门下拉树结构 */
    getIndicatorTree() {
      indicatorTreeSelect().then(response => {
        this.indicatorOptions = response.data || [];

        // 设置默认展开的节点keys（根节点和所有二级节点）
        this.defaultExpandedKeys = [];
        if (this.indicatorOptions.length > 0) {
          const rootNode = this.indicatorOptions[0];
          this.defaultExpandedKeys.push(rootNode.id); // 根节点

          // 添加所有二级节点ID
          if (rootNode.children) {
            rootNode.children.forEach(secondLevel => {
              this.defaultExpandedKeys.push(secondLevel.id);
            });
          }
        }

        // 模拟点击操作
        this.$nextTick(() => {
          this.simulateTreeClick();
        });
      });
    },
    simulateTreeClick() {
      const tree = this.$refs.tree;
      if (!tree) return;

      // 1. 模拟点击根节点
      const rootNode = tree.getNode(1); // 假设根节点ID是1
      if (rootNode) {
        // 展开根节点
        rootNode.expanded = true;

        // 2. 延迟后模拟点击第一个二级节点
        setTimeout(() => {
          if (rootNode.childNodes && rootNode.childNodes[0]) {
            const firstSecondNode = rootNode.childNodes[0];

            // 展开二级节点
            firstSecondNode.expanded = true;
            tree.setCurrentKey(firstSecondNode.data.id);

            // 3. 更新查询参数
            this.queryParams.indicatorId = firstSecondNode.data.id;
            this.getList();

            // 4. 可选：折叠三级节点
            setTimeout(() => {
              if (firstSecondNode.childNodes) {
                firstSecondNode.childNodes.forEach(thirdNode => {
                  thirdNode.expanded = false;
                });
              }
            }, 100);
          }
        }, 300);
      }
    },
    // 过滤禁用的指标
    filterDisabledIndicator(indicatorList) {
      return indicatorList.filter(indicator => {
        if (indicator.disabled) {
          return false
        }
        if (indicator.children && indicator.children.length) {
          indicator.children = this.filterDisabledIndicator(indicator.children)
        }
        return true
      })
    },
    toggleExpand(data) {
      this.expandedKeys.set(data.id, !this.expandedKeys.get(data.id));
      this.$forceUpdate();
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true
      return data.label.indexOf(value) !== -1
    },
    // 节点单击事件
    handleNodeClick(data, node) {
      this.currentIndicatorName = data.label;
      // 1. 更新查询参数
      this.queryParams.indicatorId = data.id;
      this.queryParams.pageNum = 1;

      // 2. 执行查询
      this.getList();

      // 3. 管理展开状态
      this.$nextTick(() => {
        // 点击二级节点时折叠其他同级节点
        if (node.level === 2) { // level从1开始计数
          if (node.parent) {
            node.parent.childNodes.forEach(sibling => {
              if (sibling !== node && sibling.expanded) {
                sibling.expanded = false;
              }
            });
          }
        }
      });
    },
    // 辅助方法：查找父节点
    findParentNode(target, nodes) {
      for (let i = 0; i < nodes.length; i++) {
        const node = nodes[i];
        if (node.children) {
          if (node.children.some(child => child.id === target.id)) {
            return node;
          }
          const found = this.findParentNode(target, node.children);
          if (found) return found;
        }
      }
      return null;
    },
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        attachId: null,
        indicatorId: null,
        fileName: null,
        filePath: null,
        fileSize: null,
        fileType: null,
        createBy: null,
        createTime: null
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.attachId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
      // 调试用
      console.log('当前选中IDs:', this.ids);
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加附件管理"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const attachId = row.attachId || this.ids
      getAttachment(attachId).then(response => {
        this.form = response.data
        this.open = true
        this.title = "修改附件管理"
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.attachId != null) {
            updateAttachment(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addAttachment(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('pg/attachment/export', {
        ...this.queryParams
      }, `attachment_${new Date().getTime()}.xlsx`)
    },
    /** 上传按钮操作 */
    handleUpload() {
      const selectedNode = this.$refs.tree.getCurrentNode();
      if (!selectedNode || !selectedNode.id) {
        this.$modal.msgWarning("请先在左侧选择指标节点");
        return;
      }

      this.upload.open = true;
      this.upload.fileList = [];
      this.currentIndicatorId = selectedNode.id; // 存储当前选中节点ID
    },

    // 文件超出数量限制提示
    handleExceed(files, fileList) {
      this.$modal.msgWarning(`当前限制选择 100 个文件，本次选择了 ${files.length} 个文件`);
    },

    // 文件上传失败处理
    handleFileError(err, file, fileList) {
      this.$modal.msgError(`文件 ${file.name} 上传失败: ${err.message}`);
    },

    // 文件状态改变时的回调
    handleFileChange(file, fileList) {
      this.upload.fileList = fileList; // 确保fileList同步更新
    },
    // 统一的错误处理
    handleUploadError(error) {
      console.error('上传错误:', error);
      const errMsg = error.response?.data?.message ||
        error.message ||
        '上传失败，请检查控制台';
      this.$modal.msgError(`文档上传失败: ${errMsg}`);
      this.upload.loading = false;
    },
    // 提交上传
    // 修改后的提交方法
    async submitUpload() {
      // 1. 获取当前节点
      const currentNode = this.$refs.tree.getCurrentNode();
      if (!currentNode?.id) {
        this.$modal.msgWarning("请先在左侧选择指标节点");
        return;
      }

      // 2. 获取上传文件
      const uploadFiles = this.$refs.upload.uploadFiles;
      if (uploadFiles.length === 0) {
        this.$modal.msgWarning("请先选择要上传的文件");
        return;
      }

      // 3. 构造FormData
      const formData = new FormData();
      uploadFiles.forEach(file => {
        formData.append('files', file.raw); // 参数名改为files（复数）
      });
      formData.append('indicatorId', currentNode.id);

      // 4. 使用RuoYi封装的请求方法
      this.loading = true;
      uploadFile(formData).then(response => {  // 使用项目中已有的uploadFile方法
        this.$modal.msgSuccess("上传成功");
        this.getList();
      }).catch(error => {
        this.$modal.msgError("上传失败：" + error.message);
      }).finally(() => {
        this.loading = false;
        this.upload.open = false;
      });
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      try {
        // 1. 验证响应
        if (!response || response.code !== 200) {
          throw new Error('上传失败');
        }

        // 关键修改：使用fileUrl而不是filePath
        const filePath = response.fileUrl; // 根据实际响应字段调整
        if (!filePath) {
          throw new Error('未获取到有效的文件路径');
        }

        // 3. 构造附件对象
        const attachment = {
          indicatorId: this.currentIndicatorId,
          fileName: file.name,
          filePath: filePath,
          fileSize: file.size,
          fileType: file.name.split('.').pop()?.toLowerCase() || ''
        };

        // 保存到数据库
        return addAttachment(attachment).then(() => {
          this.$modal.msgSuccess(`${file.name} 上传成功`);

          // 检查是否所有文件都上传完成且数据库保存完成
          const allFilesDone = fileList.every(f => f.status === 'success');
          if (allFilesDone) {
            this.upload.open = false; // 关闭弹窗
            this.getList(); // 刷新附件列表
          }
        });
      } catch (error) {
        this.handleUploadError(error);
        return Promise.reject(error);
      }
    },
    /** 预览文件 */
    handlePreview(row) {
      // 生成防缓存参数
      const timestamp = new Date().getTime();

      // RuoYi标准请求方式
      previewFile({
        attachId: row.attachId,
        _: timestamp
      }).then(response => {
        console.log('响应数据:', response); // 输出响应数据，用于调试
        if (!response || response.size === 0) {
          this.$modal.msgError("预览失败：未获取到有效的文件数据");
          return;
        }

        // 获取文件扩展名
        const ext = this.getFileExt(row.fileName);
        const previewType = this.getPreviewType(ext);

        if (previewType === 'pdf') {
          const blobUrl = URL.createObjectURL(response);
          this.preview = {
            visible: true,
            title: row.fileName,
            url: blobUrl,
            type: 'pdf'
          };
        } else if (previewType === 'image') {
          const reader = new FileReader();
          reader.onload = (e) => {
            this.preview = {
              visible: true,
              title: row.fileName,
              url: e.target.result,
              type: 'image'
            };
          };
          reader.onerror = () => {
            this.$modal.msgError("预览失败：读取文件数据时出错");
          };
          reader.readAsDataURL(response);
        } else {
          this.preview = {
            visible: true,
            title: row.fileName,
            url: `/pg/attachment/file/download?attachId=${row.attachId}&_=${timestamp}`,
            type: 'other'
          };
        }
      }).catch(error => {
        console.error('请求出错:', error); // 输出错误信息，用于调试
        this.$modal.msgError("预览失败：" + error.message);
      });
    },
    /**
    * 获取文件扩展名（纯字符串操作）
    */
    getFileExt(filename) {
      return filename.split('.').pop().toLowerCase();
    },

    /**
    * 下载文件
    */
    downloadFile(attachId) {
      const timestamp = new Date().getTime();
      window.open(`/pg/attachment/file/download?attachId=${attachId}&_=${timestamp}`, '_blank');
    },
    // 辅助方法：根据文件扩展名确定预览类型
    getPreviewType(ext) {
      if (ext === 'pdf') return 'pdf';
      if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext)) return 'image';
      return 'other';
    },
    // 批量删除方法
    handleMultiDelete() {
      if (this.ids.length === 0) {
        this.$modal.msgWarning("请先选择要删除的附件");
        return;
      }

      this.$modal.confirm(`确认删除选中的${this.ids.length}个附件？`).then(() => {
        this.loading = true;
        return delAttachment(this.ids.join(','));
      }).then(response => {
        this.$modal.msgSuccess(response.msg || "批量删除成功");
        this.getList();
        this.$refs.table.clearSelection(); // 清空选择
      }).catch(error => {
        this.$modal.msgError(error.response?.data?.msg || "批量删除失败");
      }).finally(() => {
        this.loading = false;
      });
    },

    // 单个删除方法（优化版）
    handleDelete(row) {
      this.$modal.confirm('确认删除该附件？').then(() => {
        this.loading = true;
        return delAttachment(row.attachId);
      }).then(response => {
        this.$modal.msgSuccess(response.msg || "删除成功");
        this.getList();
      }).catch(error => {
        this.$modal.msgError(error.response?.data?.msg || "删除失败");
      }).finally(() => {
        this.loading = false;
      });
    },
    //在新的浏览器窗口打开
    handleOpenInNewWindow() {
      window.open(this.preview.url, '_blank');
    },
    // 处理图片缩放
    handleImageZoom(event) {
      event.preventDefault();
      const delta = event.deltaY > 0 ? -0.1 : 0.1;
      const newScale = this.imageScale + delta;
      if (newScale > 0.1 && newScale < 5) {
        this.imageScale = newScale;
      }
    },
    // 关闭预览弹窗
    closePreviewDialog() {
      this.preview.visible = false;
    },

    // 拦截所有非按钮触发的关闭
    handleBeforeClose(done) {
      // 完全阻止非按钮触发的关闭
      return false;
    },
  }
}
</script>

<style scoped>
.el-upload__tip {
  margin-top: 7px;
  color: #606266;
  font-size: 12px;
  line-height: 18px;
}
.upload-demo {
  margin: 0 auto;
  text-align: center;
}
.ellipsis {
  display: inline-block;
  max-width: 100%; /* 最大宽度为容器宽度 */
  overflow: hidden; /* 超出部分隐藏 */
  text-overflow: ellipsis; /* 超出部分显示省略号 */
  white-space: nowrap; /* 不换行 */
}
/* 强制禁用遮罩层点击 */
.force-close-dialog .el-dialog__wrapper {
  pointer-events: none !important;
}

/* 恢复弹窗内容可点击 */
.force-close-dialog .el-dialog {
  pointer-events: auto !important;
}

</style>
